package puzzle.projecteuler.p100;

public class Problem086C {

	public static void main(String[] args) {

		long s = System.currentTimeMillis();
		int count = 0;
		int c = 1;
		while (count < 1000000) {
			c ++;
			for (int a = 1; a <= c; a ++) {
				for (int b = a; b <= c; b ++) {
					if (check(a,b,c)) {
						count ++;
					}
				}
			}
		}
		System.out.println(count);
		System.out.println(c);
		System.out.println((System.currentTimeMillis()-s) + " ms");
	}

	/**
	 * a<=b<=c
	 * @param a
	 * @param b
	 * @param c
	 * @return
	 */
	private static boolean check(int a, int b, int c) {

		int u = Math.max(a, Math.max(b, c));
		int v = (a+b+c) - u;
		int s = u*u + v*v;
		int t = (int)Math.sqrt(s);
		return (s == t*t);
	}
}
